package com.yilin.tms.order.service.order;


import com.baomidou.mybatisplus.extension.service.IService;
import com.yilin.tms.core.application.PageData;
import com.yilin.tms.core.commons.annotation.Explain;
import com.yilin.tms.core.entity.order.goods.ordinary.GoodsNote;
import com.yilin.tms.core.entity.order.goods.ordinary.GoodsOrdinary;
import com.yilin.tms.core.entity.order.party.ReceiptChangeRecord;
import com.yilin.tms.core.entity.order.transit.TransitOrderNote;
import com.yilin.tms.core.entity.order.transit.TransitOrder;
import com.yilin.tms.core.entity.order.transit.TransitOrderNoteDetail;
import com.yilin.tms.core.entity.order.transit.TransitOrderVehicleRecord;
import com.yilin.tms.core.entity.truck.TruckVehicle;
import com.yilin.tms.core.entity.user.account.Account;

import java.util.List;
import java.util.Map;

public interface ITransitService extends IService<TransitOrder> {

    void saveOrdinary(Account logAccount, GoodsOrdinary goodsOrdinary, List<GoodsNote> goodsNoteList, TruckVehicle truckVehicle);

    PageData<TransitOrder> getTransitOrderPage(Account loginUser, TransitOrder query, Integer start, Integer limit);

    TransitOrder getTransitOrderDetail(Account loginUser, String transitOrderId);

    List<TransitOrder> getRunTransitOrderListByDriver(String driverUserId);

    List<TransitOrder> getGatherTransitOrderList(Account loginUser, String shipperOrganizeId, String robOrganizeId,
                                                 String receiptTimeRange, Boolean matching, Boolean includedTax,String transitTruckNo);

    List<Map<String, Object>> getGatherShipperDropList(Account loginUser);

    List<Map<String, Object>> getGatherTruckerDropList(Account loginUser);

    List<TransitOrder> getBillTransitOrderList(Account loginUser, String robOrganizeId, String timeRange);

    PageData<TransitOrder> getPublicTransitOrderPage(TransitOrder query, Integer start, Integer limit);

    List<TransitOrderNote> getTransitOrderNoteList(String transitOrderId, TransitOrderNote.NoteStatus noteStatus);

    List<TransitOrderNote> getTransitOrderNoteList(String transitOrderId, TransitOrderNote.NoteStatus noteStatus, boolean contains);

    TransitOrderNote getTransitOrderNoteById(String transitOrderNoteId);

    List<TransitOrderNoteDetail> getTransitOrderNoteDetailList(String transitOrderNoteId);

    List<TransitOrderNoteDetail> getAllTransitOrderDetailList(String transitOrderId);

    int getTransitOrderNoteCount(String transitOrderId, TransitOrderNote.NoteStatus noteStatus);

    Map<String, Object> getMapNoteDataListByLoading(String transitOrderId, String truckLngLat);

    Map<String, Object> getMapNoteDataListByReceipt(@Explain("运单ID") String transitOrderId);

    boolean confirmLoading(Account loginUser, TransitOrder localTransitOrder, List<TransitOrderNote> transitOrderNoteList);

    void confirmDelivery(Account loginUser, TransitOrder localTransitOrder, boolean autoConfirmDelivery);

    int multiConfirmDelivery(Account loginUser, String[] transitOrderIds);

    void applyRecovery(Account loginUser, TransitOrder localTransitOrder);

    List<ReceiptChangeRecord> getChangeNoteReceiptRecordList(String transitOrderId);

    List<ReceiptChangeRecord> getMutiChangeNoteReceiptRecordList(List<String> transitOrderIds);

    void applyChangeNoteReceiptAddress(Account loginUser, ReceiptChangeRecord changeRecord);

    void agreedChangeNoteReceiptAddress(Account loginUser, String changeRecordId);

    void refuseChangeNoteReceiptAddress(Account loginUser, String changeRecordId);

    void dealArbitrationRefund(Account loginUser, TransitOrder transitOrder, String cancellation);

    String confirmTransit(Account loginUser, TransitOrder localTransitOrder);

    Boolean confirmArrive(Account loginUser, TransitOrder localTransitOrder, List<TransitOrderNote> transitOrderNoteList);

    void confirmReceipt(Account loginUser, TransitOrder transitOrder, boolean autoConfirmReceipt);

    boolean autoClearing(Account loginUser, TransitOrder transitOrder);

    void changeTruckOrUser(Account loginUser, TransitOrder localTransitOrder, TruckVehicle truckVehicle, TruckVehicle trailer);

    void applyPausing(Account loginUser, TransitOrder localTransitOrder);

    List<TransitOrder> getTransitOrderListByIds(String[] transitOrderIds);

    List<TransitOrder> getTransitOrderListByNos(String[] transportNos);

    List<TransitOrderNote> getTransitOrderNoteListByTransitOrderIds(String[] transitOrderIds);

    List<TransitOrderNoteDetail> getAllTransitDetailListByTransitOrderIds(String[] transitOrderIds);

    TransitOrder getTransitOrderByNo(String transportNo);

    List<TransitOrderVehicleRecord> getTransitVehicleRecordList(String transitOrderId);

    void updateTransitOrdersBillStatus(String[] transitOrderIds, Boolean status);

    void autoConfirmReceipt();

    List<TransitOrder> getErrorTmsTransitOrder(Integer transitTruckTowingType);

    List<TransitOrder> getRunTransitOrderByOrganizeId(String organizeId);

    List<TransitOrder> getRunTransitOrderByAccountId(String accountId);
}
